<?php
/**
 * Global Configuration Override
 *
 * You can use this file for overriding configuration values from modules, etc.
 * You would place values in here that are agnostic to the environment and not
 * sensitive to security.
 *
 * @NOTE: In practice, this file will typically be INCLUDED in your source
 * control, so do not include passwords or other sensitive information in this
 * file.
 */
use DoctrineModule\Cache\ZendStorageCache;

return array(
    // Service manager configuration
    'service_manager' => array(
        'factories' => array(
            // Logging configuration
            'Zend\Log' => function ($serviceManager) {
            	$log = new Zend\Log\Logger();
            	
            	$log->addWriter(new Zend\Log\Writer\Stream('./data/logs/application.log'));
            
            	return $log;
            },

            // Error logging configuration
            'Zend\ErrorLog' => function ($serviceManager) {
            	$log = new Zend\Log\Logger();
            	 
            	$log->addWriter(new Zend\Log\Writer\Stream('./data/logs/error.log'));
            
            	return $log;
            },
            
            'Application\Service\ErrorHandling' =>  function($serviceManager) {
            	$logger = $serviceManager->get('Zend\ErrorLog');
            	
            	$service = new Application\Service\ErrorHandlingService($logger);

            	return $service;
            },
            
            // Cache configuration
            'cache.static.local' => function ()
            {
                $cache = Zend\Cache\StorageFactory::factory(array(
                    'adapter' => 'filesystem',
                    'plugins' => array(
                        'exception_handler' => array(
                            'throw_exceptions' => false
                        ),
                        'serializer'
                    ),
                ));
                
                $cache->setOptions(array(
                    'cache_dir' => './data/cache',
                    'key_pattern' => '/[a-zA-Z0-9_\+\-]*/'
                ));
                                
                return $cache;
            },
            
            // Wraps a ZF2 cache storage in a Doctrine compatible way
            'doctrine.cache.zend.static.local' => function ($serviceManager)
            {
                $storageCache = new ZendStorageCache($serviceManager->get('cache.static.local'));
                
                $storageCache->setNamespace('DiArte');
                
                return $storageCache;
            }
        )
    ),
    
    // Geolocation service configuration
    'geolocation' => array(
        'database_path' => './data/maxmind/GeoIP.dat'
    ),
    
    // Social network
    'social_network' => array(
        'facebook_href' => 'http://facebook.com',    	
        'twitter_href' => 'http://twitter.com'    	
    ),
    
    // Lists
    'list_per_page_items' => array(
        'home_new_products' => 20,
		'category_products' => 12
    )
    
);
